package com.jyhg.core.web.utils.timer
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.system.ApplicationDomain;
	
	/**
	 * SwfUtil
	 * @author	韩露
	 * $Id:$
	 * @version 1.0
	 */
	public class SwfUtil
	{
		public function SwfUtil()
		{
		}
		
		public static var defaultDomain:ApplicationDomain = ApplicationDomain.currentDomain;
		
		
		
		public static function getBitmap(className:String, apDomain:ApplicationDomain=null):Bitmap{
			var clazz:Class = getClazz(className, apDomain);
			var ret:Bitmap = new Bitmap();
			var bmpData:BitmapData = new clazz(1, 1);
			ret.bitmapData = bmpData;
			return ret;
		}
		
		public static function getMovieClip(className:String, apDomain:ApplicationDomain=null):MovieClip{
			var clazz:Class = getClazz(className, apDomain);
			var ret:MovieClip = new clazz();
			return ret;
		}
		
		public static function getButton(className:String, apDomain:ApplicationDomain=null):SimpleButton{
			var clazz:Class = getClazz(className, apDomain);
			var ret:SimpleButton = new clazz();
			return ret;
		}
		
		public static function getClazz(className:String, apDomain:ApplicationDomain=null):Class{
			if(apDomain == null){
				apDomain = defaultDomain;
			}
			return apDomain.getDefinition(className) as Class;
		}
		
	}
}
